#include "MenuBar.h"

namespace hps {

MenuBar::MenuBar(QMainWindow *parent) {
    setUi();
    rspFunc();
}

void MenuBar::setUi() {
    // 创建菜单栏;
    m_noteBookMenu = this->addMenu("笔记本");
    m_noteMenu = this->addMenu("笔记");
    m_importMenu = this->addMenu("导入");
    m_outPutMenu = this->addMenu("导出");
    m_helpMenu = this->addMenu("帮助");

    makeQAction();
    addQAction();
}

void MenuBar::makeQAction() {
    // 添加“笔记本“action
    m_addBook = new QAction("新建笔记本");
    m_openBook = new QAction("打开笔记本");
    m_mgrBook = new QAction("管理笔记本");
    m_saveFile = new QAction("保存文件");

    // 添加“笔记”action
    m_addNote = new QAction("新建笔记");
    m_openNote = new QAction("打开笔记");
    m_mgrNote = new QAction("管理笔记");

    // 导入action
    m_importBook = new QAction("导入笔记本");
    m_importNote = new QAction("导入笔记");

    // 导出
    m_toHtmlFile = new QAction("导出为html");
    m_toXmlFile = new QAction("导出为xml");
    m_toJsonFile = new QAction("导出为json");
    m_toPdfFile = new QAction("导出为pdf");

    // 帮助
    m_helpDoc = new QAction("帮助文档");
}

void MenuBar::addQAction() {
    m_noteBookMenu->addAction(m_addBook);
    m_noteBookMenu->addAction(m_openBook);
    m_noteBookMenu->addSeparator();

    // 后续需要可以增加
//    m_noteBookMenu->addAction(m_mgrBook);
    m_noteBookMenu->addAction(m_saveFile);

    m_noteMenu->addAction(m_addNote);
    m_noteMenu->addAction(m_openNote);
    m_noteMenu->addSeparator();
//    m_noteMenu->addAction(m_mgrNote);

    m_importMenu->addAction(m_importBook);
    m_importMenu->addAction(m_importNote);

    m_outPutMenu->addAction(m_toHtmlFile);
//    m_outPutMenu->addAction(m_toXmlFile);
    m_outPutMenu->addAction(m_toJsonFile);
    m_outPutMenu ->addAction(m_toPdfFile);

    m_helpMenu->addAction(m_helpDoc);
}

void MenuBar::rspFunc() {

}

}